/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package database.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Stefan
 */
@Entity
@Table(name = "action")
@NamedQueries({
    @NamedQuery(name = "Action.findAll", query = "SELECT a FROM Action a"),
    @NamedQuery(name = "Action.findByActionid", query = "SELECT a FROM Action a WHERE a.actionid = :actionid"),
    @NamedQuery(name = "Action.findByActiondiscout", query = "SELECT a FROM Action a WHERE a.actiondiscout = :actiondiscout"),
    @NamedQuery(name = "Action.findByActionfrom", query = "SELECT a FROM Action a WHERE a.actionfrom = :actionfrom"),
    @NamedQuery(name = "Action.findByActionto", query = "SELECT a FROM Action a WHERE a.actionto = :actionto"),
    @NamedQuery(name = "Action.findByActionactive", query = "SELECT a FROM Action a WHERE a.actionactive = :actionactive")})
public class Action implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ACTIONID")
    private Integer actionid;
    @Basic(optional = false)
    @Column(name = "ACTIONDISCOUT")
    private BigDecimal actiondiscout;
    @Basic(optional = false)
    @Column(name = "ACTIONFROM")
    @Temporal(TemporalType.DATE)
    private Date actionfrom;
    @Column(name = "ACTIONTO")
    @Temporal(TemporalType.DATE)
    private Date actionto;
    @Basic(optional = false)
    @Column(name = "ACTIONACTIVE")
    private boolean actionactive;
    @Basic(optional = false)
    @Lob
    @Column(name = "ACTIONDESCRIPTION")
    private String actiondescription;
    @JoinTable(name = "relationship_7", joinColumns = {
        @JoinColumn(name = "ACTIONID", referencedColumnName = "ACTIONID")}, inverseJoinColumns = {
        @JoinColumn(name = "ITEMID", referencedColumnName = "ITEMID")})
    @ManyToMany(fetch = FetchType.LAZY)
    private List<ShopItem> shopItemList;

    public Action() {
    }

    public Action(Integer actionid) {
        this.actionid = actionid;
    }

    public Action(Integer actionid, BigDecimal actiondiscout, Date actionfrom, boolean actionactive, String actiondescription) {
        this.actionid = actionid;
        this.actiondiscout = actiondiscout;
        this.actionfrom = actionfrom;
        this.actionactive = actionactive;
        this.actiondescription = actiondescription;
    }

    public Integer getActionid() {
        return actionid;
    }

    public void setActionid(Integer actionid) {
        this.actionid = actionid;
    }

    public BigDecimal getActiondiscout() {
        return actiondiscout;
    }

    public void setActiondiscout(BigDecimal actiondiscout) {
        this.actiondiscout = actiondiscout;
    }

    public Date getActionfrom() {
        return actionfrom;
    }

    public void setActionfrom(Date actionfrom) {
        this.actionfrom = actionfrom;
    }

    public Date getActionto() {
        return actionto;
    }

    public void setActionto(Date actionto) {
        this.actionto = actionto;
    }

    public boolean getActionactive() {
        return actionactive;
    }

    public void setActionactive(boolean actionactive) {
        this.actionactive = actionactive;
    }

    public String getActiondescription() {
        return actiondescription;
    }

    public void setActiondescription(String actiondescription) {
        this.actiondescription = actiondescription;
    }

    public List<ShopItem> getShopItemList() {
        return shopItemList;
    }

    public void setShopItemList(List<ShopItem> shopItemList) {
        this.shopItemList = shopItemList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (actionid != null ? actionid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Action)) {
            return false;
        }
        Action other = (Action) object;
        if ((this.actionid == null && other.actionid != null) || (this.actionid != null && !this.actionid.equals(other.actionid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "database.entity.Action[actionid=" + actionid + "]";
    }

}
